<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition template="/template/DefaultTemplate.xhtml">

        <ui:define name="content">
            
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages globalOnly="true" errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>
                <p:panel toggleable="true" id="salesLeadCreate" header="Create a new vendor">
                    <h:panelGrid columns="3">
                        <h:outputLabel value="CompanyName" for="companyName" />
                        <p:inputText  required ="true" requiredMessage="Company name is missing" 
                                      id="companyName" value="#{vendorEntityController.selected.companyName}"  /> 
                        <h:message styleClass="errorMsg" for= "companyName"/>

                        <h:outputLabel value="JobTitle" for="jobTitle" />
                        <p:inputText id="jobTitle" value="#{vendorEntityController.selected.jobTitle}" required="true" requiredMessage="Job title is missing" />
                        <h:message styleClass="errorMsg" for= "jobTitle"/>
                        <h:outputLabel value="Title" for="title" />
                        <h:selectOneMenu id="title" value="#{vendorEntityController.selected.title}" title="#{bundle.CreateSalesLeadEntityTitle_title}" >
                            <f:selectItems value="#{systemUserEntityController.userTitles}"/>
                        </h:selectOneMenu>
                        <h:message styleClass="errorMsg" for= "title"/>
                        
                        <h:outputLabel value="UserName" for="name" />
                        <p:inputText id="name" value="#{vendorEntityController.selected.name}"  
                                     required="true" requiredMessage="UserName is missing" 
                                     validator ="#{systemUserEntityController.validateUserName}">
                        </p:inputText>
                        <h:message styleClass="errorMsg" for= "name"/>

                        <h:outputLabel value="FirstName" for="firstName" />
                        <p:inputText id="firstName" value="#{vendorEntityController.selected.firstName}" required="true" requiredMessage="First name is missing"/>
                        <h:message styleClass="errorMsg" for= "firstName"/>

                        <h:outputLabel value="#{bundle.CreateSalesLeadEntityLabel_lastName}" for="lastName" />
                        <p:inputText id="lastName" value="#{vendorEntityController.selected.lastName}"  required="true" requiredMessage="Last name is missing"/>
                        <h:message styleClass="errorMsg" for= "lastName"/>

               


                    </h:panelGrid>
                </p:panel>
                <br/>
                <p:panel toggleable="true" id="salesLeadContact" header="Contact Details">
                    <h:panelGrid columns="3">
                        <h:outputLabel value="ContactNumber" />
                        <p:inputText id="ContactNumber" value="#{vendorEntityController.selected.contact.contactNumber}" title="#{bundle.CreateSalesLeadEntityTitle_contactNumber}" required="true" requiredMessage="Contact Number is missing" >
                            <f:validator validatorId="macTeam.ContactNumberValidator" />
                        </p:inputText>
                        <h:message styleClass="errorMsg" for= "ContactNumber"/>


                        <h:outputLabel value="Email"  />
                        <p:inputText id="email" value="#{vendorEntityController.selected.contact.email}"  required="true" requiredMessage="Email is missing" validator ="#{contactEntityController.validateEmail}">
                            <f:validator validatorId="macTeam.EmailValidator" />
                        </p:inputText>
                        <h:message styleClass="errorMsg" for= "email" />                                      

                    </h:panelGrid>


                    <br />
                </p:panel>
                <p:separator style="width:400px;height:15px" />  
                 <br />
                <p:panel header="Vendor Address: " style="text-align: center" >
                    <h:panelGrid columns="2" style="width: 100%;"> 
                        
                        
                     
                            <p:panel header="Office Addrress:" toggleable="true">
                            <h:panelGrid columns="2"> 
                               <h:outputLabel value="Street Address :"/> 
                             
                                
                                    <p:inputText value="#{vendorEntityController.address1.streetAddress}" 
                                                 required="true"  requiredMessage="StreetName is missing" />  
                         
                                
                               
                                <h:outputLabel value="City:"/>
                                     
                                    <p:inputText value="#{vendorEntityController.address1.city}" 
                                                 required="true" requiredMessage="city is missing" />  
                             
                            
                               
                                <h:outputLabel value="StateOrProvince:"/>
                                       
                                    <p:inputText value="#{vendorEntityController.address1.stateOrProvice}" 
                                                 required="true" requiredMessage="State is missing"/>  
                              
                              
                                
                                <h:outputLabel value="Country:"/>
                                <h:selectOneMenu  id ="country" style ="text-align: center" value="#{vendorEntityController.address1.country}"  >
                            <f:selectItems value="#{vendorEntityController.country}"/>
                        </h:selectOneMenu>
                 
                                
                                
                           
                               
                               
                                <h:outputLabel value="Zip code:"/>
                             
                                    <p:inputText value="#{vendorEntityController.address1.zipCode}" 
                                                 />  
                         
                            </h:panelGrid> 
                        </p:panel >
                            
                               <p:panel header="Billing addrress:" toggleable="true">
                            <h:panelGrid columns="2" > 
                           
                                <h:outputLabel value="Street Address:"/>
                                   
                                    <p:inputText value="#{vendorEntityController.addresse1.streetAddress}" 
                                                 required="true" requiredMessage="StreetName is missing"  />  
                       
                           
                             
                                <h:outputLabel value="City:"/>
                                     
                                    <p:inputText value="#{vendorEntityController.addresse1.city}" 
                                                 required="true" requiredMessage="city is missing"/>  
                             
                               
                                <h:outputLabel value="State Or Province:"/>
                                
                                    <p:inputText value="#{vendorEntityController.addresse1.stateOrProvice}" 
                                                 required="true"  requiredMessage="State is missing" />  
                             
                                 

                                <h:outputLabel value="Country:"/>
                                <h:selectOneMenu  id ="country1" style ="text-align: center" value="#{vendorEntityController.addresse1.country}"  >
                            <f:selectItems value="#{vendorEntityController.country}"/>
                        </h:selectOneMenu>
                           
                              
                                
                                <h:outputLabel value="Zip code:"/>
                                       
                                    <p:inputText value="#{vendorEntityController.addresse1.zipCode}" 
                                                 />  
                               
                          
                            </h:panelGrid>
                        </p:panel>  
                                
                           
                            
                       
                       
                    </h:panelGrid>
                </p:panel>
                
                <br />
                <p:separator style="width:400px;height:15px" /> 
 <p:fieldset legend="Raw Material Provided:" toggleable="true" toggleSpeed="500"  
              
           >   

                <p:pickList value="#{vendorEntityController.rmsPickList}"  
                             var="item"  
                            itemLabel="#{item}"  
                            itemValue="#{item}">
                    <f:facet name="sourceCaption">All Raw Materials List</f:facet>  
                    <f:facet name="targetCaption">Raw Materials provided </f:facet>
                </p:pickList>
</p:fieldset > 

             <p:separator />  
             <br/>
                <p:commandButton ajax="false" action="#{vendorEntityController.createRedirectToIndex}" value="#{bundle.CreateSalesLeadEntitySaveLink}" update ="growl" />              

            </h:form>
        </ui:define>
    </ui:composition>

</html>
